from app.libs.error_code import Success
from app.libs.redprint import Redprint
from app.libs.token_auth import login_required
from app.models.job import JobModel

api = Redprint('job')


@api.route('/<int:group_id>', methods=['POST'])
@login_required
def new_job(group_id):
    JobModel().new_jod(group_id)
    return Success()


@api.route('/<int:group_id>', methods=['PUT'])
@login_required
def pause_job(group_id):
    JobModel().pause_job(group_id)
    return Success()
